home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 40
/
Aminet 40 (2000)(Schatztruhe)[!][Dec 2000].iso
/
Aminet
/
util
/
cdity
/
ModeProSrc.lha
/
Daemon
/
MPWinPatch.c
< prev
next >
Wrap
C/C++ Source or Header
|
1998-11-02
|
5KB
|
199 lines
#define DEBUG
#include "MP.h"
#include <debug.h>
#include "patchdata.h"
#include <tagitemmacros.h>
#define ADD_DEBUG_CODE
extern struct MPSem *MPSem;
extern struct Window ASM *(*OldOpenWindow)(REG __a0 struct NewWindow *nw,
REG __a6 struct IntuitionBase *lib);
extern struct Window ASM *(*OldOpenWindowTagList)(REG __a0 struct NewWindow *nw,
REG __a1 struct TagItem *tags,
REG __a6 struct IntuitionBase *lib);
extern BOOL ASM *(*OldLayoutMenusA)(REG __a0 struct Menu *fm,
REG __a1 APTR vi,
REG __a2 struct TagItem *tags,
REG __a6 struct Library *lib);
struct Window __saveds ASM *NewOpenWindow(REG __a0 struct ExtNewWindow *nw,
REG __a6 struct IntuitionBase *IBase)
{
STRPTR pubname;
struct Screen *scr=0;
struct Window *w;
ULONG oldflags;
char tnamebuffer[52];
char *tname;
ULONG stack1=0xc0de0010;
DoNothing(&stack1);
tname=SetupTaskName(tnamebuffer,", OW",50);
DEBUG_CODE(
DKP("OpenWindow(%8lx)\n",nw);
PrintNewWindowData(nw);
);
oldflags=nw->Flags; // Store orignal flags
if(nw->Flags & WFLG_NW_EXTENDED) // order changed
{
/* validate ram */// (4.60.1)
if(((ULONG)nw->Extension & 1)==0 && TypeOfMem(nw->Extension))// (4.60.1)
{
if(pubname=(STRPTR)GetTagData(WA_PubScreenName,0,nw->Extension))
{
/* Make sure this screen exeist */
scr=LockPubScreen(pubname);
}
}
}
if(MPSem->EnabledNLM) // order changed
{
nw->Flags|=WFLG_NEWLOOKMENUS;
}
w=OldOpenWindow((struct NewWindow *)nw,IBase);
if(scr)
{
UnlockPubScreen(0,scr);
}
nw->Flags=oldflags; // restore orignal flags
#ifdef ADD_DEBUG_CODE
if(MPSem->Debug)
{
DKP(" RV=%8lx\n",w);
}
#endif
SetTaskName(tname);
return(w);
}
struct Window __saveds ASM *NewOpenWindowTagList(REG __a0 struct ExtNewWindow *nw,
REG __a1 struct TagItem *TagList,
REG __a6 struct IntuitionBase *IBase)
{
STRPTR pubname;
struct Screen *scr=0;
struct Window *w;
struct TagItem ti[]={WA_NewLookMenus , TRUE ,
TAG_DONE , 0};
char tnamebuffer[52];
char *tname;
ULONG stack1=0xc0de0011;
DoNothing(&stack1);
tname=SetupTaskName(tnamebuffer,", OWTL",50);
DEBUG_CODE(// (4.56.2)
DKP("OpenWindowTagList(%8lx,%8lx)\n",nw,TagList);// (4.56.2)
PrintNewWindowData(nw);//
PrintWindowTags(TagList);// (4.56.2)
); // (4.56.2)
if(MPSem->EnabledNLM)
{
if(TagList)
{
ti[1].ti_Tag =TAG_MORE;
ti[1].ti_Data=(ULONG)TagList;
}
TagList=ti;
}
if(pubname=(STRPTR)GetTagData(WA_PubScreenName,0,TagList))
{
/* Make sure this screen exeist */
scr=LockPubScreen(pubname);
}
w=(struct Window *)OldOpenWindowTagList((struct NewWindow *)nw,TagList,IBase);
if(scr)
{
UnlockPubScreen(0,scr);
}
#ifdef ADD_DEBUG_CODE
if(MPSem->Debug)
{
DKP(" RV=%8lx\n",w);
}
#endif
SetTaskName(tname);
return(w);
}
BOOL __saveds ASM NewLayoutMenusA(REG __a0 struct Menu *fm,
REG __a1 APTR vi,
REG __a2 struct TagItem *tags,
REG __a6 struct Library *GTBase)
{
BOOL rv;
struct TagItem ti[]=
{
GTMN_NewLookMenus,TRUE,
TAG_DONE,0
};
char tnamebuffer[52];
char *tname;
ULONG stack1=0xc0de0012;
DoNothing(&stack1);
tname=SetupTaskName(tnamebuffer,", LMA",50);
#ifdef ADD_DEBUG_CODE
if(MPSem->Debug)
{
DKP("LayoutMenus(%8lx,%8lx,%8lx) -- %s\n",fm,vi,tags,FindTask(0)->tc_Node.ln_Name);
}
#endif
// ObtainSemaphoreShared(&MPSem->ListSem);
if(MPSem->EnabledNLM)
{
if(tags)
{
ti[1].ti_Tag=TAG_MORE;
ti[1].ti_Data=(ULONG)tags;
}
tags=ti;
}
rv=(BOOL)OldLayoutMenusA(fm,vi,tags,GTBase);
#ifdef ADD_DEBUG_CODE
if(MPSem->Debug)
{
DKP(" RV=%8lx\n",rv);
}
#endif
// ReleaseSemaphore(&MPSem->ListSem);
SetTaskName(tname);
return(rv);
}